package org.zoomdev.zoom.rpc.client;

import java.util.concurrent.ThreadLocalRandom;

public class GroupHandler implements Handler {
    private final Handler[] handlers;

    public GroupHandler(Handler[] handlers) {
        this.handlers = handlers;
    }


    @Override
    public Completer handle(Object[] args) {
        int index = ThreadLocalRandom.current().nextInt(handlers.length);
        return this.handlers[index].handle(args);
    }
}
